<template>
  <div class="div">
    <Nav :leftShow="left_show" :leftName="left_name" :rightName="right_name" :titleName="title_name">
    </Nav>
    <div class="address" v-if="items">
      <van-radio-group v-model="radio">
        <van-radio name="1" checked-color="#07c160" class="click">
        </van-radio>
      </van-radio-group>
      <span class="a1" v-for="(item,index) in items" :key="index">
        <div class="div0" @click="clickAction(index)">
          <div class="div1">
            <span class="name1">
              {{item.name}}
            </span>
            {{item.sex}}
            {{item.telephone}}
          </div>
          <div class="div2">
            <span class="red">
              {{item.label}}
            </span>
            {{item.detail}}
          </div>
        </div>
      </span>
    </div>
    <div class="add1" @click="clickAction1">
      <i class="iconfont icon-mainongji"></i>
      <span>
        新增收获地址
      </span>
    </div>
  </div>
</template>
<script>
  import Nav from "@/components/Nav.vue";
  export default {
    name: "chooseaddr",
    data() {
      return {
        left_show: false,
        left_name: '空',
        title_name: '选择地址',
        right_name: '',
        items: JSON.parse(localStorage.getItem("arr2")),
        radio: '1',
      }
    },
    methods: {
      clickAction(index) {
        this.$router.push({ name: 'Order', query: { key: index } }),
          console.log(index)
      },
      clickAction1() {
        this.$router.push({ name: "addaddr" })
      }
    },
    components: {
      Nav,
    }
  }
</script>
<style lang="less" scoped>
  .a1 {
    position: relative;
    margin: 20px;
  }

  .address {
    margin-top: 44px;
  }

  .icon-mainongji {
    color: rgb(49, 144, 232);
  }

  .add1 {
    position: absolute;
    left: 130px;
    top: 580px;
    color: rgb(49, 144, 232);
  }

  .add1 span {
    font-size: 16px;
  }

  .icon-mainongji {
    font-size: 24px;
  }

  .name1 {
    font-weight: 600;
    font-size: 20px;
  }

  .red {
    background-color: rgb(255, 87, 34);
    color: white;
    text-align: center;
    margin-right: 10px;
  }

  .div1 {
    padding-left: 40px;
    padding-bottom: 10px;
  }

  .div2 {
    padding-left: 40px;
    padding-bottom: 10px;
    font-size: 14px;
  }

  .address {
    position: relative;
  }

  .click {
    position: absolute;
    left: 10px;
    top: 20px;
  }
</style>